package com.lzzy;
// 泛型方法-1
public class GenericMethodDemo {
  public static void main(String[] args ) {
    Integer[] integers = {1, 2, 3, 4, 5};
    String[] strings = {"London", "Paris", "New York", "Austin"};
    Double[] doubles = {0.1,0.2,0.3,0.4,0.5,0.6};

    Student st1=new Student(123456,"yang");
    Student st2=new Student(310243,"jing");
    Student[] students={st1,st2};

    wooden st=new wooden(12345,"碳化木桌");
    wooden[] woodens = {st};



    GenericMethodDemo.<Integer>print(integers);
    GenericMethodDemo.<String>print(strings);
    GenericMethodDemo.<Double>print(doubles);
    GenericMethodDemo.print(students);
    GenericMethodDemo.print(woodens);


  }

  public static <E> void print(E[] list) {
    for (int i = 0; i < list.length; i++)
      System.out.print(list[i] + " ");
    System.out.println();
  }
}
